package com.whf.web.dto;

import com.fasterxml.jackson.annotation.JsonView;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Past;
import java.util.Date;

/**
 * user与页面交互的实体类,@Jsonview注解用于json返回时显示不同的视图
 * */
public class User {
    public interface SimpleUserView{};
    public interface DetailUserView extends SimpleUserView{};

    private String id;
    private String username;
    @NotBlank
    private String password;
    //生日必须是过去时间
    @Past(message = "生日必须是过去时间")
    private Date birthday;

    @JsonView(SimpleUserView.class)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @JsonView(SimpleUserView.class)
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }



    @JsonView(SimpleUserView.class)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @JsonView(DetailUserView.class)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
